import java.util.ArrayList;
import java.util.List;

/**
 * @program: LeetCode
 * @description: LeetCode : 剑指 Offer II 057. 值和下标之差都在给定的范围内
 * @author: WXY
 * @create: 2023-01-05 11:23
 * @Version 1.0
 **/
public class offer_nineteen3_MyCalendar {
    class MyCalendar {

        List<int[]> list;

        public MyCalendar() {
            list = new ArrayList<>();
        }

        public boolean book(int start, int end) {
            for (int i = 0; i < list.size(); i++) {
                int[] arr = list.get(i);
                if (start < arr[1] && arr[0] < end) {
                    return false;
                }
            }
            list.add(new int[]{start, end});
            return true;
        }
    }
}
